println "<h5>hello world</h5>"
a=[1,2,3]
println a

/////////////////////////////////////////////
if (!session) {
  session = request.getSession(true);
}

if (!session.counter) {
  session.counter = 1
}

println """
<html>
    <head>
        <title>Groovy Servlet</title>
    </head>
    <body>
Hello, ${request.remoteHost}: ${session.counter}! ${new Date()}
    </body>
</html>
"""
session.counter = session.counter + 1

/*
<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
        prefix="servlet." suffix=".log" timestamp="true" />
*/
// to log to localhost-<date>.log
session.getServletContext().log("ZZZZZZZZZZZ")

/////////////////////////////////////////////
// or do the same thing with Markup builder
if (!session) {
  session = request.getSession(true)
}

if (!session.counter) {
      session.counter = 1
}

html.html {    // html is implicitly bound to new MarkupBuilder(out)
  head {
      title("Groovy Servlet")
  }
  body {
    p("Hello, ${request.remoteHost}: ${session.counter}! ${new Date()}")
  }
}
session.counter = session.counter + 1


response.setContentType("text/xml");

println "request:"+request
println "<br>"
println "response:"+response
println "<br>"

println "response.contentType:"+response.getContentType()

println "<br>"
println "<br>"
println "<br>"
println "<br>"


response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");

println "Hello World !"
println "This is Groovy Speaking"

println "<br>"+response.getContentType();

println "You requested the Resource ${resource} (yes, this is a GString)"
